package org.ishequ.domain;

import java.util.Date;
import org.ishequ.utils.DateUtil;

public class PhoneCall {

	private long id;
	private String receiver;
	private String sender;
	private Date receiveTime;
	private long duration;
	private String audioName;
	private long uploadPos = 0;
	private long length = 0;
	private boolean uploadTag = false;

	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}

	public String getReceiver() {
		return receiver;
	}
	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}

	public String getSender() {
		return sender;
	}
	public void setSender(String sender) {
		this.sender = sender;
	}

	public Date getReceiveTime() {
		return receiveTime;
	}
	public void setReceiveTime(Date receiveTime) {
		this.receiveTime = receiveTime;
	}

	public long getDuration() {
		return duration;
	}
	public void setDuration(long duration) {
		this.duration = duration;
	}

	public String getAudioName() {
		return audioName;
	}
	
	public void setAudioName(String audioName) {
		this.audioName = audioName;
	}
	
	public long getUploadPos() {
		return uploadPos;
	}
	
	public void setUploadPos(long uploadPos) {
		this.uploadPos = uploadPos;
	}
	
	public long getLength() {
		return length;
	}
	
	public void setLength(long length) {
		this.length = length;
	}
	
	public boolean isUploadTag() {
		return uploadTag;
	}
	
	public void setUploadTag(boolean uploadTag) {
		this.uploadTag = uploadTag;
	}
	
	public PhoneCall(String receiver, String sender, Date receiveTime,
			long duration, String audioName, long length) {
		this.receiver = receiver;
		this.sender = sender;
		this.receiveTime = receiveTime;
		this.duration = duration;
		this.audioName = audioName;
		this.length = length;
	}
	
	public PhoneCall() {
	}

	@Override
	public String toString() {
		return "PhoneCall [audioName=" + audioName + ", duration=" + duration
				+ ", id=" + id + ", receiveTime=" + receiveTime + ", receiver="
				+ receiver + ", sender=" + sender + ", uploadPos="+ uploadPos + ","+ length +","+ uploadTag +"]";
	}
	
	public String getAudioFullpath(){
		return audioName!=null ? 
				DateUtil.stringToString(audioName.substring(audioName.indexOf("_")+1,audioName.indexOf(".")-4), "yyyyMMdd", "yyyy/MM/dd") :
				null;
	}
	
}
